VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "LUsuario"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
Dim dao As DAOUsuario

Public Function guardarNuevo(bean As busuario) As Integer
Set dao.Connection = utilConexion
guardarNuevo = dao.guardarNuevo(bean)
End Function

Public Function actualizar(bean As busuario) As Integer
Set dao.Connection = utilConexion
actualizar = dao.actualizar(bean)
End Function


Public Function getLista(bean As busuario) As Collection
Set dao.Connection = utilConexion
Set getLista = dao.getLista(bean)
End Function

Public Function eliminar(bean As busuario) As Integer
Set dao.Connection = utilConexion
bean.bEstado.nCodigo = UtilConstantes.ESTADO_USUARIO_INACTIVO
eliminar = dao.actualizar(bean)
End Function

Public Function getUsuario(busuario As busuario) As busuario
Set dao.Connection = utilConexion
Set getUsuario = dao.getUsuario(busuario)

End Function

Public Function login(ByRef bean As busuario) As Integer
Dim busuario As busuario

Set dao.Connection = utilConexion

Set busuario = dao.login(bean)
If busuario Is Nothing Then
    login = UtilConstantes.OPT_LOGIN_CLAVE_INCORRECTA
    Exit Function
End If

If busuario.bEstado.nCodigo = UtilConstantes.ESTADO_USUARIO_INACTIVO Then
    login = UtilConstantes.OPT_LOGIN_CUENTA_DESHABILITADA
    Exit Function
End If

Set bParametro.bUsuarioActivo = busuario
login = UtilConstantes.OPT_LOGIN
End Function

Private Sub Class_Initialize()
Set dao = New DAOUsuario
End Sub
